


#md5加密
import requests


def make_password(mypass):
    # 生成对象
    md5 = hashlib.md5()
    # 定义加密对象
    sign_str = mypass
    # 转码
    sign_utf8 = str(sign_str).encode(encoding='utf-8')
    # 加密
    md5.update(sign_utf8)
    # 生成密文
    md5_server = md5.hexdigest()

    return md5_server

# password = input()
# password1 = make_password('123456')
# if make_password(password) == password1:
#     print('比对成功')
# else:
#     print('比对失败')



files = {'file':('adv01.jpg',open('C:/adv01.jpg','rb'))}
res = requests.post('http://localhost:8000/upload/',files = files)
print(res.text)



# print(make_password('123'))


# data = {'username':'1','password':'1'}
#
# res = requests.post('http://localhost:8000/login/',data=data)
# print(res.text)

# data = {'username':'123',
#         'password':'yang',
#         'email':'123',
#         'pthone':'14567845362',
#         'password1':'yang',
#         }
#
# res = requests.get('http://localhost:8000/registers/',params=data)
# print(res.text)

import base64
import json
import urllib.parse
import urllib


import requests
import hashlib



# res = requests.get("https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=X1kkwVwvnoSbONGEyL88AZrP&client_secret=HeH5pTRPBf2FbRGsqSAh0YvFKT2C6dvt")
#
# res = json.loads(str(res.text))
# token = res['access_token']
# print(token)
#
#
#
# temp_url = 'https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic?access_token=' + '24.0213754a8cd7a03937957c7bbb8be9fb.2592000.1613033612.282335-23530724'
# temp_headers = {'Content-Type': 'application/x-www-form-urlencoded'}
# temp_file = open('./123.png', 'rb')
# temp_image = temp_file.read()
# temp_file.close()
# temp_data = {'image': base64.b64encode(temp_image)}
# temp_data = urllib.parse.urlencode(temp_data)
# temp_res = requests.post(url=temp_url, data=temp_data, headers=temp_headers)
#
# res = json.loads(str(temp_res.text))
# code = res['words_result'][0]['words']
# print(code)